package com.webserver.core;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class BirdApplication {
    private ServerSocket serverSocket;

    public BirdApplication(){
        try {
            System.out.println("正在启动服务端...");
            serverSocket = new ServerSocket(8999);
            System.out.println("服务端启动完毕!");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void start(){
        try {
            Socket socket = serverSocket.accept();
            ClientHandler handler = new ClientHandler(socket);
            Thread t = new Thread(handler);
            t.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        BirdApplication application = new BirdApplication();
        application.start();
    }
}
